package com.GB26875_3_2011.message.request;

import com.GB26875_3_2011.common.CommandType;
import com.GB26875_3_2011.common.DataUnitType;
import com.GB26875_3_2011.message.MessageContext;
import com.GB26875_3_2011.model.GB26875Message;

/**
 * @author 蒋仕国
 * @projectName GB26875_3_211
 * @ClassName MessageRequest_04_81
 * @date 2025-01-14 16:42
 * @Description: TODO []
 */

public class MessageRequest_04_81 implements MessageRequest {
    private final GB26875Message gb26875Message;
    private final long timeout;

    public MessageRequest_04_81(String destinationAddressHex, long timeout) {
        gb26875Message = new GB26875Message();
        gb26875Message.setDestinationAddressHex(destinationAddressHex);
        byte[] bytes = new byte[1];
        gb26875Message.setCommandType(CommandType.COMMAND_04).setDataUnitType(DataUnitType.MESSAGE_81)
                .setUnitCount(1).setMessageBody(bytes);
        this.timeout = timeout;
    }


    @Override
    public GB26875Message sendMessage() {
        return MessageContext.request(gb26875Message, timeout);
    }
}
